﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevEx.Thanh.Class;

namespace DevEx.Thanh.FORM
{
    public partial class frmChonThang : Form
    {
        public frmChonThang()
        {
            InitializeComponent();
        }
        private void frmChonThang_Load(object sender, EventArgs e)
        {
            cmbMonth.SelectedIndex = 0;
            btPrint.DialogResult = DialogResult.OK;
            txtYear.Text = DateTime.Now.Year.ToString ();
        }
        public DateTime NgayCuoiThang{ get; set; }

        private void btPrint_Click(object sender, EventArgs e)
        {
            if (CThanh_Utilities.isNumericInt(txtYear.Text ) == false)
            {
                txtYear.Focus();
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                return;
            }
            if (cmbMonth.Text == "")
            {
                cmbMonth.Focus();
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                return;
            }
            string sThang = cmbMonth.Text;
            int thang = int.Parse(sThang.Replace("Tháng ", ""));
            NgayCuoiThang= CThanh_Utilities.KhoiTaoNgayCuoiThang(thang, int.Parse(txtYear.Text));
        } 
    }
}
